#ifndef _Manage_Union_DB_H_
#define _Manage_Union_DB_H_

#include "DBAgentServant.h"
#include "ClubProto.h"

using namespace std;
using namespace dbagent;

// 获取联盟列表
tars::Int32 ManageUnionList(const DBAgentServantPrx prx, std::vector<Club::UnionDBInfo> &infoList, tars::Int64 uId);

// 获取联盟DB信息
tars::Int32 ManageUnionGetDBInfo(const DBAgentServantPrx prx, Club::UnionDBInfo &info, tars::Int64 nId);

// 获取联盟成员
tars::Int32 ManageUnionGetMember(const DBAgentServantPrx prx, Club::UnionDBMember &info, tars::Int64 nId, tars::Int64 cId);

// 生成联盟ID
tars::Int32 ManageUnionGenerateID(const DBAgentServantPrx prx, tars::Int64 &nId);

// 检查联盟ID唯一性
tars::Int32 ManageUnionCheckIDExist(const DBAgentServantPrx prx, tars::Int64 nId);

// 检查联盟名字唯一性
tars::Int32 ManageUnionCheckNameExist(const DBAgentServantPrx prx, string unionName);

// 获取俱乐部的联盟ID
tars::Int32 ManageUnionGetIDForClub(const DBAgentServantPrx prx, tars::Int64 cId, tars::Int64 &nId);

// 获取联盟成员数量
tars::Int32 ManageUnionGetMemberCount(const DBAgentServantPrx prx, tars::Int64 nId, int &count);

// 获取个人联盟职位
tars::Int32 ManageUnionGetOwnPosition(const DBAgentServantPrx prx, tars::Int64 nId, tars::Int64 cId, int &position);

// 获取联盟下的所有俱乐部CID
tars::Int32 ManageUnionMemberIdList(const DBAgentServantPrx prx, const long nId, vector<long> &cIdList);

// 创建联盟
tars::Int32 ManageUnionInsert(const DBAgentServantPrx prx, tars::Int64 nId, tars::Int64 uId, string name, tars::Int32 lv);

// 创建联盟成员
tars::Int32 ManageUnionInsertMember(const DBAgentServantPrx prx, tars::Int64 nId, tars::Int64 cId);

// 更新联盟信息
tars::Int32 ManageUnionModify(const DBAgentServantPrx prx, tars::Int64 nId, int flag, int status, string name, int level, int show);

// 更新联盟基金(无用)
tars::Int32 ModifyUnionBalance(const DBAgentServantPrx prx, tars::Int64 nId, bool isAdd, long balance);

// 更新联盟成员俱乐币(无用)
tars::Int32 ModifyUnionMember(const DBAgentServantPrx prx, tars::Int64 nId, tars::Int64 cId, tars::Int32 flag, tars::Int64 balance);

// 删除联盟成员
tars::Int32 ManageUnionDeleteMember(const DBAgentServantPrx prx, tars::Int64 nId, tars::Int64 cId);

// 申请列表
tars::Int32 ManageUnionApplyList(const DBAgentServantPrx prx, std::vector<Club::UnionApplyInfo> &infoList, int &count, string &sNid, tars::Int32 pageIndex);

// 获取联盟单个申请详情
tars::Int32 ManageUnionGetApply(const DBAgentServantPrx prx, Club::UnionApplyInfo &info, tars::Int64 id);

// 创建联盟申请信息
tars::Int32 ManageUnionInsertApply(const DBAgentServantPrx prx, tars::Int64 nId, tars::Int64 cId, tars::Int32 status, string msg);

// 检测联盟申请信息
bool ManageUnionCheckApply(const DBAgentServantPrx prx, tars::Int64 nId, tars::Int64 cId);

// 更新联盟申请信息
tars::Int32 ManageUnionUpdateApply(const DBAgentServantPrx prx, tars::Int64 nId, tars::Int64 cId, string msg);

// 修改俱乐部申请信息
tars::Int32 ManageUnionModifyApply(const DBAgentServantPrx prx, tars::Int64 id, tars::Int64 uId, tars::Int32 status);

#endif